home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / docs / gdb / gdb.i7 (.txt) < prev    next >
GNU Info File  |  1994-07-26  |  50KB  |  918 lines

  1. This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
  2. file gdb.texinfo.
  3. START-INFO-DIR-ENTRY
  4. * Gdb::                         The GNU debugger.
  5. END-INFO-DIR-ENTRY
  6.    This file documents the GNU debugger GDB.
  7.    This is Edition 4.12, January 1994, of `Debugging with GDB: the GNU
  8. Source-Level Debugger' for GDB Version 4.12.
  9.    Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
  10. Foundation, Inc.
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided also
  16. that the entire resulting derived work is distributed under the terms
  17. of a permission notice identical to this one.
  18.    Permission is granted to copy and distribute translations of this
  19. manual into another language, under the above conditions for modified
  20. versions.
  21. File: gdb.info,  Node: Hooks,  Next: Command Files,  Prev: Define,  Up: Sequences
  22. User-defined command hooks
  23. ==========================
  24.    You may define *hooks*, which are a special kind of user-defined
  25. command.  Whenever you run the command `foo', if the user-defined
  26. command `hook-foo' exists, it is executed (with no arguments) before
  27. that command.
  28.    In addition, a pseudo-command, `stop' exists.  Defining
  29. (`hook-stop') makes the associated commands execute every time
  30. execution stops in your program: before breakpoint commands are run,
  31. displays are printed, or the stack frame is printed.
  32.    For example, to ignore `SIGALRM' signals while single-stepping, but
  33. treat them normally during normal execution, you could define:
  34.      define hook-stop
  35.      handle SIGALRM nopass
  36.      end
  37.      
  38.      define hook-run
  39.      handle SIGALRM pass
  40.      end
  41.      
  42.      define hook-continue
  43.      handle SIGLARM pass
  44.      end
  45.    You can define a hook for any single-word command in GDB, but not
  46. for command aliases; you should define a hook for the basic command
  47. name, e.g.  `backtrace' rather than `bt'.  If an error occurs during
  48. the execution of your hook, execution of GDB commands stops and GDB
  49. issues a prompt (before the command that you actually typed had a
  50. chance to run).
  51.    If you try to define a hook which does not match any known command,
  52. you get a warning from the `define' command.
  53. File: gdb.info,  Node: Command Files,  Next: Output,  Prev: Hooks,  Up: Sequences
  54. Command files
  55. =============
  56.    A command file for GDB is a file of lines that are GDB commands.
  57. Comments (lines starting with `#') may also be included.  An empty line
  58. in a command file does nothing; it does not mean to repeat the last
  59. command, as it would from the terminal.
  60.    When you start GDB, it automatically executes commands from its
  61. "init files".  These are files named `.gdbinit'.  GDB reads the init
  62. file (if any) in your home directory, then processes command line
  63. options and operands, and then reads the init file (if any) in the
  64. current working directory.  This is so the init file in your home
  65. directory can set options (such as `set complaints') which affect the
  66. processing of the command line options and operands.  The init files
  67. are not executed if you use the `-nx' option; *note Choosing modes:
  68. Mode Options..
  69.    On some configurations of GDB, the init file is known by a different
  70. name (these are typically environments where a specialized form of GDB
  71. may need to coexist with other forms, hence a different name for the
  72. specialized version's init file).  These are the environments with
  73. special init file names:
  74.    * VxWorks (Wind River Systems real-time OS): `.vxgdbinit'
  75.    * OS68K (Enea Data Systems real-time OS): `.os68gdbinit'
  76.    * ES-1800 (Ericsson Telecom AB M68000 emulator): `.esgdbinit'
  77.    You can also request the execution of a command file with the
  78. `source' command:
  79. `source FILENAME'
  80.      Execute the command file FILENAME.
  81.    The lines in a command file are executed sequentially.  They are not
  82. printed as they are executed.  An error in any command terminates
  83. execution of the command file.
  84.    Commands that would ask for confirmation if used interactively
  85. proceed without asking when used in a command file.  Many GDB commands
  86. that normally print messages to say what they are doing omit the
  87. messages when called from command files.
  88. File: gdb.info,  Node: Output,  Prev: Command Files,  Up: Sequences
  89. Commands for controlled output
  90. ==============================
  91.    During the execution of a command file or a user-defined command,
  92. normal GDB output is suppressed; the only output that appears is what is
  93. explicitly printed by the commands in the definition.  This section
  94. describes three commands useful for generating exactly the output you
  95. want.
  96. `echo TEXT'
  97.      Print TEXT.  Nonprinting characters can be included in TEXT using
  98.      C escape sequences, such as `\n' to print a newline.  *No newline
  99.      is printed unless you specify one.* In addition to the standard C
  100.      escape sequences, a backslash followed by a space stands for a
  101.      space.  This is useful for displaying a string with spaces at the
  102.      beginning or the end, since leading and trailing spaces are
  103.      otherwise trimmed from all arguments.  To print ` and foo = ', use
  104.      the command `echo \ and foo = \ '.
  105.      A backslash at the end of TEXT can be used, as in C, to continue
  106.      the command onto subsequent lines.  For example,
  107.           echo This is some text\n\
  108.           which is continued\n\
  109.           onto several lines.\n
  110.      produces the same output as
  111.           echo This is some text\n
  112.           echo which is continued\n
  113.           echo onto several lines.\n
  114. `output EXPRESSION'
  115.      Print the value of EXPRESSION and nothing but that value: no
  116.      newlines, no `$NN = '.  The value is not entered in the value
  117.      history either.  *Note Expressions: Expressions, for more
  118.      information on expressions.
  119. `output/FMT EXPRESSION'
  120.      Print the value of EXPRESSION in format FMT.  You can use the same
  121.      formats as for `print'.  *Note Output formats: Output Formats, for
  122.      more information.
  123. `printf STRING, EXPRESSIONS...'
  124.      Print the values of the EXPRESSIONS under the control of STRING.
  125.      The EXPRESSIONS are separated by commas and may be either numbers
  126.      or pointers.  Their values are printed as specified by STRING,
  127.      exactly as if your program were to execute the C subroutine
  128.           printf (STRING, EXPRESSIONS...);
  129.      For example, you can print two values in hex like this:
  130.           printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  131.      The only backslash-escape sequences that you can use in the format
  132.      string are the simple ones that consist of backslash followed by a
  133.      letter.
  134. File: gdb.info,  Node: Emacs,  Next: GDB Bugs,  Prev: Sequences,  Up: Top
  135. Using GDB under GNU Emacs
  136. *************************
  137.    A special interface allows you to use GNU Emacs to view (and edit)
  138. the source files for the program you are debugging with GDB.
  139.    To use this interface, use the command `M-x gdb' in Emacs.  Give the
  140. executable file you want to debug as an argument.  This command starts
  141. GDB as a subprocess of Emacs, with input and output through a newly
  142. created Emacs buffer.
  143.    Using GDB under Emacs is just like using GDB normally except for two
  144. things:
  145.    * All "terminal" input and output goes through the Emacs buffer.
  146.    This applies both to GDB commands and their output, and to the input
  147. and output done by the program you are debugging.
  148.    This is useful because it means that you can copy the text of
  149. previous commands and input them again; you can even use parts of the
  150. output in this way.
  151.    All the facilities of Emacs' Shell mode are available for interacting
  152. with your program.  In particular, you can send signals the usual
  153. way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a stop.
  154.    * GDB displays source code through Emacs.
  155.    Each time GDB displays a stack frame, Emacs automatically finds the
  156. source file for that frame and puts an arrow (`=>') at the left margin
  157. of the current line.  Emacs uses a separate buffer for source display,
  158. and splits the screen to show both your GDB session and the source.
  159.    Explicit GDB `list' or search commands still produce output as
  160. usual, but you probably have no reason to use them from Emacs.
  161.      *Warning:* If the directory where your program resides is not your
  162.      current directory, it can be easy to confuse Emacs about the
  163.      location of the source files, in which case the auxiliary display
  164.      buffer does not appear to show your source.  GDB can find programs
  165.      by searching your environment's `PATH' variable, so the GDB input
  166.      and output session proceeds normally; but Emacs does not get
  167.      enough information back from GDB to locate the source files in
  168.      this situation.  To avoid this problem, either start GDB mode from
  169.      the directory where your program resides, or specify a full path
  170.      name when prompted for the `M-x gdb' argument.
  171.      A similar confusion can result if you use the GDB `file' command to
  172.      switch to debugging a program in some other location, from an
  173.      existing GDB buffer in Emacs.
  174.    By default, `M-x gdb' calls the program called `gdb'.  If you need
  175. to call GDB by a different name (for example, if you keep several
  176. configurations around, with different names) you can set the Emacs
  177. variable `gdb-command-name'; for example,
  178.      (setq gdb-command-name "mygdb")
  179. (preceded by `ESC ESC', or typed in the `*scratch*' buffer, or in your
  180. `.emacs' file) makes Emacs call the program named "`mygdb'" instead.
  181.    In the GDB I/O buffer, you can use these special Emacs commands in
  182. addition to the standard Shell mode commands:
  183. `C-h m'
  184.      Describe the features of Emacs' GDB Mode.
  185. `M-s'
  186.      Execute to another source line, like the GDB `step' command; also
  187.      update the display window to show the current file and location.
  188. `M-n'
  189.      Execute to next source line in this function, skipping all function
  190.      calls, like the GDB `next' command.  Then update the display window
  191.      to show the current file and location.
  192. `M-i'
  193.      Execute one instruction, like the GDB `stepi' command; update
  194.      display window accordingly.
  195. `M-x gdb-nexti'
  196.      Execute to next instruction, using the GDB `nexti' command; update
  197.      display window accordingly.
  198. `C-c C-f'
  199.      Execute until exit from the selected stack frame, like the GDB
  200.      `finish' command.
  201. `M-c'
  202.      Continue execution of your program, like the GDB `continue'
  203.      command.
  204.      *Warning:* In Emacs v19, this command is `C-c C-p'.
  205. `M-u'
  206.      Go up the number of frames indicated by the numeric argument
  207.      (*note Numeric Arguments: (emacs)Arguments.), like the GDB `up'
  208.      command.
  209.      *Warning:* In Emacs v19, this command is `C-c C-u'.
  210. `M-d'
  211.      Go down the number of frames indicated by the numeric argument,
  212.      like the GDB `down' command.
  213.      *Warning:* In Emacs v19, this command is `C-c C-d'.
  214. `C-x &'
  215.      Read the number where the cursor is positioned, and insert it at
  216.      the end of the GDB I/O buffer.  For example, if you wish to
  217.      disassemble code around an address that was displayed earlier,
  218.      type `disassemble'; then move the cursor to the address display,
  219.      and pick up the argument for `disassemble' by typing `C-x &'.
  220.      You can customize this further by defining elements of the list
  221.      `gdb-print-command'; once it is defined, you can format or
  222.      otherwise process numbers picked up by `C-x &' before they are
  223.      inserted.  A numeric argument to `C-x &' indicates that you wish
  224.      special formatting, and also acts as an index to pick an element
  225.      of the list.  If the list element is a string, the number to be
  226.      inserted is formatted using the Emacs function `format'; otherwise
  227.      the number is passed as an argument to the corresponding list
  228.      element.
  229.    In any source file, the Emacs command `C-x SPC' (`gdb-break') tells
  230. GDB to set a breakpoint on the source line point is on.
  231.    If you accidentally delete the source-display buffer, an easy way to
  232. get it back is to type the command `f' in the GDB buffer, to request a
  233. frame display; when you run under Emacs, this recreates the source
  234. buffer if necessary to show you the context of the current frame.
  235.    The source files displayed in Emacs are in ordinary Emacs buffers
  236. which are visiting the source files in the usual way.  You can edit the
  237. files with these buffers if you wish; but keep in mind that GDB
  238. communicates with Emacs in terms of line numbers.  If you add or delete
  239. lines from the text, the line numbers that GDB knows cease to
  240. correspond properly with the code.
  241. File: gdb.info,  Node: GDB Bugs,  Next: Command Line Editing,  Prev: Emacs,  Up: Top
  242. Reporting Bugs in GDB
  243. *********************
  244.    Your bug reports play an essential role in making GDB reliable.
  245.    Reporting a bug may help you by bringing a solution to your problem,
  246. or it may not.  But in any case the principal function of a bug report
  247. is to help the entire community by making the next version of GDB work
  248. better.  Bug reports are your contribution to the maintenance of GDB.
  249.    In order for a bug report to serve its purpose, you must include the
  250. information that enables us to fix the bug.
  251. * Menu:
  252. * Bug Criteria::                Have you found a bug?
  253. * Bug Reporting::               How to report bugs
  254. File: gdb.info,  Node: Bug Criteria,  Next: Bug Reporting,  Up: GDB Bugs
  255. Have you found a bug?
  256. =====================
  257.    If you are not sure whether you have found a bug, here are some
  258. guidelines:
  259.    * If the debugger gets a fatal signal, for any input whatever, that
  260.      is a GDB bug.  Reliable debuggers never crash.
  261.    * If GDB produces an error message for valid input, that is a bug.
  262.    * If GDB does not produce an error message for invalid input, that
  263.      is a bug.  However, you should note that your idea of "invalid
  264.      input" might be our idea of "an extension" or "support for
  265.      traditional practice".
  266.    * If you are an experienced user of debugging tools, your suggestions
  267.      for improvement of GDB are welcome in any case.
  268. File: gdb.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: GDB Bugs
  269. How to report bugs
  270. ==================
  271.    A number of companies and individuals offer support for GNU products.
  272. If you obtained GDB from a support organization, we recommend you
  273. contact that organization first.
  274.    You can find contact information for many support companies and
  275. individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
  276.    In any event, we also recommend that you send bug reports for GDB to
  277. one of these addresses:
  278.      bug-gdb@prep.ai.mit.edu
  279.      {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-gdb
  280.    *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
  281. newsgroups.* Most users of GDB do not want to receive bug reports.
  282. Those that do, have arranged to receive `bug-gdb'.
  283.    The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
  284. serves as a repeater.  The mailing list and the newsgroup carry exactly
  285. the same messages.  Often people think of posting bug reports to the
  286. newsgroup instead of mailing them.  This appears to work, but it has one
  287. problem which can be crucial: a newsgroup posting often lacks a mail
  288. path back to the sender.  Thus, if we need to ask for more information,
  289. we may be unable to reach you.  For this reason, it is better to send
  290. bug reports to the mailing list.
  291.    As a last resort, send bug reports on paper to:
  292.      GNU Debugger Bugs
  293.      Free Software Foundation
  294.      545 Tech Square
  295.      Cambridge, MA 02139
  296.    The fundamental principle of reporting bugs usefully is this:
  297. *report all the facts*.  If you are not sure whether to state a fact or
  298. leave it out, state it!
  299.    Often people omit facts because they think they know what causes the
  300. problem and assume that some details do not matter.  Thus, you might
  301. assume that the name of the variable you use in an example does not
  302. matter.  Well, probably it does not, but one cannot be sure.  Perhaps
  303. the bug is a stray memory reference which happens to fetch from the
  304. location where that name is stored in memory; perhaps, if the name were
  305. different, the contents of that location would fool the debugger into
  306. doing the right thing despite the bug.  Play it safe and give a
  307. specific, complete example.  That is the easiest thing for you to do,
  308. and the most helpful.
  309.    Keep in mind that the purpose of a bug report is to enable us to fix
  310. the bug if it is new to us.  It is not as important as what happens if
  311. the bug is already known.  Therefore, always write your bug reports on
  312. the assumption that the bug has not been reported previously.
  313.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  314. bell?"  Those bug reports are useless, and we urge everyone to *refuse
  315. to respond to them* except to chide the sender to report bugs properly.
  316.    To enable us to fix the bug, you should include all these things:
  317.    * The version of GDB.  GDB announces it if you start with no
  318.      arguments; you can also print it at any time using `show version'.
  319.      Without this, we will not know whether there is any point in
  320.      looking for the bug in the current version of GDB.
  321.    * The type of machine you are using, and the operating system name
  322.      and version number.
  323.    * What compiler (and its version) was used to compile GDB--e.g.
  324.      "gcc-2.0".
  325.    * What compiler (and its version) was used to compile the program you
  326.      are debugging--e.g.  "gcc-2.0".
  327.    * The command arguments you gave the compiler to compile your
  328.      example and observe the bug.  For example, did you use `-O'?  To
  329.      guarantee you will not omit something important, list them all.  A
  330.      copy of the Makefile (or the output from make) is sufficient.
  331.      If we were to try to guess the arguments, we would probably guess
  332.      wrong and then we might not encounter the bug.
  333.    * A complete input script, and all necessary source files, that will
  334.      reproduce the bug.
  335.    * A description of what behavior you observe that you believe is
  336.      incorrect.  For example, "It gets a fatal signal."
  337.      Of course, if the bug is that GDB gets a fatal signal, then we will
  338.      certainly notice it.  But if the bug is incorrect output, we might
  339.      not notice unless it is glaringly wrong.  We are human, after all.
  340.      You might as well not give us a chance to make a mistake.
  341.      Even if the problem you experience is a fatal signal, you should
  342.      still say so explicitly.  Suppose something strange is going on,
  343.      such as, your copy of GDB is out of synch, or you have encountered
  344.      a bug in the C library on your system.  (This has happened!)  Your
  345.      copy might crash and ours would not.  If you told us to expect a
  346.      crash, then when ours fails to crash, we would know that the bug
  347.      was not happening for us.  If you had not told us to expect a
  348.      crash, then we would not be able to draw any conclusion from our
  349.      observations.
  350.    * If you wish to suggest changes to the GDB source, send us context
  351.      diffs.  If you even discuss something in the GDB source, refer to
  352.      it by context, not by line number.
  353.      The line numbers in our development sources will not match those
  354.      in your sources.  Your line numbers would convey no useful
  355.      information to us.
  356.    Here are some things that are not necessary:
  357.    * A description of the envelope of the bug.
  358.      Often people who encounter a bug spend a lot of time investigating
  359.      which changes to the input file will make the bug go away and which
  360.      changes will not affect it.
  361.      This is often time consuming and not very useful, because the way
  362.      we will find the bug is by running a single example under the
  363.      debugger with breakpoints, not by pure deduction from a series of
  364.      examples.  We recommend that you save your time for something else.
  365.      Of course, if you can find a simpler example to report *instead*
  366.      of the original one, that is a convenience for us.  Errors in the
  367.      output will be easier to spot, running under the debugger will take
  368.      less time, and so on.
  369.      However, simplification is not vital; if you do not want to do
  370.      this, report the bug anyway and send us the entire test case you
  371.      used.
  372.    * A patch for the bug.
  373.      A patch for the bug does help us if it is a good one.  But do not
  374.      omit the necessary information, such as the test case, on the
  375.      assumption that a patch is all we need.  We might see problems
  376.      with your patch and decide to fix the problem another way, or we
  377.      might not understand it at all.
  378.      Sometimes with a program as complicated as GDB it is very hard to
  379.      construct an example that will make the program follow a certain
  380.      path through the code.  If you do not send us the example, we will
  381.      not be able to construct one, so we will not be able to verify
  382.      that the bug is fixed.
  383.      And if we cannot understand what bug you are trying to fix, or why
  384.      your patch should be an improvement, we will not install it.  A
  385.      test case will help us to understand.
  386.    * A guess about what the bug is or what it depends on.
  387.      Such guesses are usually wrong.  Even we cannot guess right about
  388.      such things without first using the debugger to find the facts.
  389. File: gdb.info,  Node: Command Line Editing,  Next: Using History Interactively,  Prev: GDB Bugs,  Up: Top
  390. Command Line Editing
  391. ********************
  392.    This text describes GNU's command line editing interface.
  393. * Menu:
  394. * Introduction and Notation::    Notation used in this text.
  395. * Readline Interaction::    The minimum set of commands for editing a line.
  396. * Readline Init File::        Customizing Readline from a user's view.
  397. File: gdb.info,  Node: Introduction and Notation,  Next: Readline Interaction,  Up: Command Line Editing
  398. Introduction to Line Editing
  399. ============================
  400.    The following paragraphs describe the notation we use to represent
  401. keystrokes.
  402.    The text C-k is read as `Control-K' and describes the character
  403. produced when the Control key is depressed and the k key is struck.
  404.    The text M-k is read as `Meta-K' and describes the character
  405. produced when the meta key (if you have one) is depressed, and the k
  406. key is struck.  If you do not have a meta key, the identical keystroke
  407. can be generated by typing ESC first, and then typing k.  Either
  408. process is known as "metafying" the k key.
  409.    The text M-C-k is read as `Meta-Control-k' and describes the
  410. character produced by "metafying" C-k.
  411.    In addition, several keys have their own names.  Specifically, DEL,
  412. ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this
  413. text, or in an init file (*note Readline Init File::., for more info).
  414. File: gdb.info,  Node: Readline Interaction,  Next: Readline Init File,  Prev: Introduction and Notation,  Up: Command Line Editing
  415. Readline Interaction
  416. ====================
  417.    Often during an interactive session you type in a long line of text,
  418. only to notice that the first word on the line is misspelled.  The
  419. Readline library gives you a set of commands for manipulating the text
  420. as you type it in, allowing you to just fix your typo, and not forcing
  421. you to retype the majority of the line.  Using these editing commands,
  422. you move the cursor to the place that needs correction, and delete or
  423. insert the text of the corrections.  Then, when you are satisfied with
  424. the line, you simply press RETURN.  You do not have to be at the end of
  425. the line to press RETURN; the entire line is accepted regardless of the
  426. location of the cursor within the line.
  427. * Menu:
  428. * Readline Bare Essentials::    The least you need to know about Readline.
  429. * Readline Movement Commands::    Moving about the input line.
  430. * Readline Killing Commands::    How to delete text, and how to get it back!
  431. * Readline Arguments::        Giving numeric arguments to commands.
  432. File: gdb.info,  Node: Readline Bare Essentials,  Next: Readline Movement Commands,  Up: Readline Interaction
  433. Readline Bare Essentials
  434. ------------------------
  435.    In order to enter characters into the line, simply type them.  The
  436. typed character appears where the cursor was, and then the cursor moves
  437. one space to the right.  If you mistype a character, you can use DEL to
  438. back up, and delete the mistyped character.
  439.    Sometimes you may miss typing a character that you wanted to type,
  440. and not notice your error until you have typed several other
  441. characters.  In that case, you can type C-b to move the cursor to the
  442. left, and then correct your mistake.  Aftwerwards, you can move the
  443. cursor to the right with C-f.
  444.    When you add text in the middle of a line, you will notice that
  445. characters to the right of the cursor get `pushed over' to make room
  446. for the text that you have inserted.  Likewise, when you delete text
  447. behind the cursor, characters to the right of the cursor get `pulled
  448. back' to fill in the blank space created by the removal of the text.  A
  449. list of the basic bare essentials for editing the text of an input line
  450. follows.
  451.      Move back one character.
  452.      Move forward one character.
  453.      Delete the character to the left of the cursor.
  454.      Delete the character underneath the cursor.
  455. Printing characters
  456.      Insert itself into the line at the cursor.
  457.      Undo the last thing that you did.  You can undo all the way back
  458.      to an empty line.
  459. File: gdb.info,  Node: Readline Movement Commands,  Next: Readline Killing Commands,  Prev: Readline Bare Essentials,  Up: Readline Interaction
  460. Readline Movement Commands
  461. --------------------------
  462.    The above table describes the most basic possible keystrokes that
  463. you need in order to do editing of the input line.  For your
  464. convenience, many other commands have been added in addition to C-b,
  465. C-f, C-d, and DEL.  Here are some commands for moving more rapidly
  466. about the line.
  467.      Move to the start of the line.
  468.      Move to the end of the line.
  469.      Move forward a word.
  470.      Move backward a word.
  471.      Clear the screen, reprinting the current line at the top.
  472.    Notice how C-f moves forward a character, while M-f moves forward a
  473. word.  It is a loose convention that control keystrokes operate on
  474. characters while meta keystrokes operate on words.
  475. File: gdb.info,  Node: Readline Killing Commands,  Next: Readline Arguments,  Prev: Readline Movement Commands,  Up: Readline Interaction
  476. Readline Killing Commands
  477. -------------------------
  478.    "Killing" text means to delete the text from the line, but to save
  479. it away for later use, usually by "yanking" it back into the line.  If
  480. the description for a command says that it `kills' text, then you can
  481. be sure that you can get the text back in a different (or the same)
  482. place later.
  483.    Here is the list of commands for killing text.
  484.      Kill the text from the current cursor position to the end of the
  485.      line.
  486.      Kill from the cursor to the end of the current word, or if between
  487.      words, to the end of the next word.
  488. M-DEL
  489.      Kill from the cursor to the start of the previous word, or if
  490.      between words, to the start of the previous word.
  491.      Kill from the cursor to the previous whitespace.  This is
  492.      different than M-DEL because the word boundaries differ.
  493.    And, here is how to "yank" the text back into the line.  Yanking is
  494.      Yank the most recently killed text back into the buffer at the
  495.      cursor.
  496.      Rotate the kill-ring, and yank the new top.  You can only do this
  497.      if the prior command is C-y or M-y.
  498.    When you use a kill command, the text is saved in a "kill-ring".
  499. Any number of consecutive kills save all of the killed text together, so
  500. that when you yank it back, you get it in one clean sweep.  The kill
  501. ring is not line specific; the text that you killed on a previously
  502. typed line is available to be yanked back later, when you are typing
  503. another line.
  504. File: gdb.info,  Node: Readline Arguments,  Prev: Readline Killing Commands,  Up: Readline Interaction
  505. Readline Arguments
  506. ------------------
  507.    You can pass numeric arguments to Readline commands.  Sometimes the
  508. argument acts as a repeat count, other times it is the sign of the
  509. argument that is significant.  If you pass a negative argument to a
  510. command which normally acts in a forward direction, that command will
  511. act in a backward direction.  For example, to kill text back to the
  512. start of the line, you might type M- C-k.
  513.    The general way to pass numeric arguments to a command is to type
  514. meta digits before the command.  If the first `digit' you type is a
  515. minus sign (-), then the sign of the argument will be negative.  Once
  516. you have typed one meta digit to get the argument started, you can type
  517. the remainder of the digits, and then the command.  For example, to give
  518. the C-d command an argument of 10, you could type M-1 0 C-d.
  519. File: gdb.info,  Node: Readline Init File,  Prev: Readline Interaction,  Up: Command Line Editing
  520. Readline Init File
  521. ==================
  522.    Although the Readline library comes with a set of Emacs-like
  523. keybindings, it is possible that you would like to use a different set
  524. of keybindings.  You can customize programs that use Readline by putting
  525. commands in an "init" file in your home directory.  The name of this
  526. file is `~/.inputrc'.
  527.    When a program which uses the Readline library starts up, the
  528. `~/.inputrc' file is read, and the keybindings are set.
  529.    In addition, the C-x C-r command re-reads this init file, thus
  530. incorporating any changes that you might have made to it.
  531. * Menu:
  532. * Readline Init Syntax::    Syntax for the commands in `~/.inputrc'.
  533. * Readline Vi Mode::        Switching to `vi' mode in Readline.
  534. File: gdb.info,  Node: Readline Init Syntax,  Next: Readline Vi Mode,  Up: Readline Init File
  535. Readline Init Syntax
  536. --------------------
  537.    There are only four constructs allowed in the `~/.inputrc' file:
  538. Variable Settings
  539.      You can change the state of a few variables in Readline.  You do
  540.      this by using the `set' command within the init file.  Here is how
  541.      you would specify that you wish to use Vi line editing commands:
  542.           set editing-mode vi
  543.      Right now, there are only a few variables which can be set; so few
  544.      in fact, that we just iterate them here:
  545.     `editing-mode'
  546.           The `editing-mode' variable controls which editing mode you
  547.           are using.  By default, GNU Readline starts up in Emacs
  548.           editing mode, where the keystrokes are most similar to Emacs.
  549.           This variable can either be set to `emacs' or `vi'.
  550.     `horizontal-scroll-mode'
  551.           This variable can either be set to `On' or `Off'.  Setting it
  552.           to `On' means that the text of the lines that you edit will
  553.           scroll horizontally on a single screen line when they are
  554.           larger than the width of the screen, instead of wrapping onto
  555.           a new screen line.  By default, this variable is set to `Off'.
  556.     `mark-modified-lines'
  557.           This variable when set to `On', says to display an asterisk
  558.           (`*') at the starts of history lines which have been modified.
  559.           This variable is off by default.
  560.     `prefer-visible-bell'
  561.           If this variable is set to `On' it means to use a visible
  562.           bell if one is available, rather than simply ringing the
  563.           terminal bell.  By default, the value is `Off'.
  564. Key Bindings
  565.      The syntax for controlling keybindings in the `~/.inputrc' file is
  566.      simple.  First you have to know the name of the command that you
  567.      want to change.  The following pages contain tables of the command
  568.      name, the default keybinding, and a short description of what the
  569.      command does.
  570.      Once you know the name of the command, simply place the name of
  571.      the key you wish to bind the command to, a colon, and then the
  572.      name of the command on a line in the `~/.inputrc' file.  The name
  573.      of the key can be expressed in different ways, depending on which
  574.      is most comfortable for you.
  575.     KEYNAME: FUNCTION-NAME or MACRO
  576.           KEYNAME is the name of a key spelled out in English.  For
  577.           example:
  578.                Control-u: universal-argument
  579.                Meta-Rubout: backward-kill-word
  580.                Control-o: ">&output"
  581.           In the above example, C-u is bound to the function
  582.           `universal-argument', and C-o is bound to run the macro
  583.           expressed on the right hand side (that is, to insert the text
  584.           `>&output' into the line).
  585.     "KEYSEQ": FUNCTION-NAME or MACRO
  586.           KEYSEQ differs from KEYNAME above in that strings denoting an
  587.           entire key sequence can be specified.  Simply place the key
  588.           sequence in double quotes.  GNU Emacs style key escapes can
  589.           be used, as in the following example:
  590.                "\C-u": universal-argument
  591.                "\C-x\C-r": re-read-init-file
  592.                "\e[11~": "Function Key 1"
  593.           In the above example, C-u is bound to the function
  594.           `universal-argument' (just as it was in the first example),
  595.           C-x C-r is bound to the function `re-read-init-file', and ESC
  596.           [ 1 1 ~ is bound to insert the text `Function Key 1'.
  597. * Menu:
  598. * Commands For Moving::        Moving about the line.
  599. * Commands For History::    Getting at previous lines.
  600. * Commands For Text::        Commands for changing text.
  601. * Commands For Killing::    Commands for killing and yanking.
  602. * Numeric Arguments::        Specifying numeric arguments, repeat counts.
  603. * Commands For Completion::    Getting Readline to do the typing for you.
  604. * Miscellaneous Commands::    Other miscillaneous commands.
  605. File: gdb.info,  Node: Commands For Moving,  Next: Commands For History,  Up: Readline Init Syntax
  606. Commands For Moving
  607. -------------------
  608. `beginning-of-line (C-a)'
  609.      Move to the start of the current line.
  610. `end-of-line (C-e)'
  611.      Move to the end of the line.
  612. `forward-char (C-f)'
  613.      Move forward a character.
  614. `backward-char (C-b)'
  615.      Move back a character.
  616. `forward-word (M-f)'
  617.      Move forward to the end of the next word.
  618. `backward-word (M-b)'
  619.      Move back to the start of this, or the previous, word.
  620. `clear-screen (C-l)'
  621.      Clear the screen leaving the current line at the top of the screen.
  622. File: gdb.info,  Node: Commands For History,  Next: Commands For Text,  Prev: Commands For Moving,  Up: Readline Init Syntax
  623. Commands For Manipulating The History
  624. -------------------------------------
  625. `accept-line (Newline, Return)'
  626.      Accept the line regardless of where the cursor is.  If this line is
  627.      non-empty, add it to the history list.  If this line was a history
  628.      line, then restore the history line to its original state.
  629. `previous-history (C-p)'
  630.      Move `up' through the history list.
  631. `next-history (C-n)'
  632.      Move `down' through the history list.
  633. `beginning-of-history (M-<)'
  634.      Move to the first line in the history.
  635. `end-of-history (M->)'
  636.      Move to the end of the input history, i.e., the line you are
  637.      entering!
  638. `reverse-search-history (C-r)'
  639.      Search backward starting at the current line and moving `up'
  640.      through the history as necessary.  This is an incremental search.
  641. `forward-search-history (C-s)'
  642.      Search forward starting at the current line and moving `down'
  643.      through the the history as necessary.
  644. File: gdb.info,  Node: Commands For Text,  Next: Commands For Killing,  Prev: Commands For History,  Up: Readline Init Syntax
  645. Commands For Changing Text
  646. --------------------------
  647. `delete-char (C-d)'
  648.      Delete the character under the cursor.  If the cursor is at the
  649.      beginning of the line, and there are no characters in the line, and
  650.      the last character typed was not C-d, then return EOF.
  651. `backward-delete-char (Rubout)'
  652.      Delete the character behind the cursor.  A numeric arg says to kill
  653.      the characters instead of deleting them.
  654. `quoted-insert (C-q, C-v)'
  655.      Add the next character that you type to the line verbatim.  This is
  656.      how to insert things like C-q for example.
  657. `tab-insert (M-TAB)'
  658.      Insert a tab character.
  659. `self-insert (a, b, A, 1, !, ...)'
  660.      Insert yourself.
  661. `transpose-chars (C-t)'
  662.      Drag the character before point forward over the character at
  663.      point.  Point moves forward as well.  If point is at the end of
  664.      the line, then transpose the two characters before point.
  665.      Negative args don't work.
  666. `transpose-words (M-t)'
  667.      Drag the word behind the cursor past the word in front of the
  668.      cursor moving the cursor over that word as well.
  669. `upcase-word (M-u)'
  670.      Uppercase all letters in the current (or following) word.  With a
  671.      negative argument, do the previous word, but do not move point.
  672. `downcase-word (M-l)'
  673.      Lowercase all letters in the current (or following) word.  With a
  674.      negative argument, do the previous word, but do not move point.
  675. `capitalize-word (M-c)'
  676.      Uppercase the first letter in the current (or following) word.
  677.      With a negative argument, do the previous word, but do not move
  678.      point.
  679. File: gdb.info,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Readline Init Syntax
  680. Killing And Yanking
  681. -------------------
  682. `kill-line (C-k)'
  683.      Kill the text from the current cursor position to the end of the
  684.      line.
  685. `backward-kill-line ()'
  686.      Kill backward to the beginning of the line.  This is normally
  687.      unbound.
  688. `kill-word (M-d)'
  689.      Kill from the cursor to the end of the current word, or if between
  690.      words, to the end of the next word.
  691. `backward-kill-word (M-DEL)'
  692.      Kill the word behind the cursor.
  693. `unix-line-discard (C-u)'
  694.      Do what C-u used to do in Unix line input.  We save the killed
  695.      text on the kill-ring, though.
  696. `unix-word-rubout (C-w)'
  697.      Do what C-w used to do in Unix line input.  The killed text is
  698.      saved on the kill-ring.  This is different than backward-kill-word
  699.      because the word boundaries differ.
  700. `yank (C-y)'
  701.      Yank the top of the kill ring into the buffer at point.
  702. `yank-pop (M-y)'
  703.      Rotate the kill-ring, and yank the new top.  You can only do this
  704.      if the prior command is yank or yank-pop.
  705. File: gdb.info,  Node: Numeric Arguments,  Next: Commands For Completion,  Prev: Commands For Killing,  Up: Readline Init Syntax
  706. Specifying Numeric Arguments
  707. ----------------------------
  708. `digit-argument (M-0, M-1, ... M--)'
  709.      Add this digit to the argument already accumulating, or start a new
  710.      argument.  M- starts a negative argument.
  711. `universal-argument ()'
  712.      Do what C-u does in emacs.  By default, this is not bound.
  713. File: gdb.info,  Node: Commands For Completion,  Next: Miscellaneous Commands,  Prev: Numeric Arguments,  Up: Readline Init Syntax
  714. Letting Readline Type For You
  715. -----------------------------
  716. `complete (TAB)'
  717.      Attempt to do completion on the text before point.  This is
  718.      implementation defined.  Generally, if you are typing a filename
  719.      argument, you can do filename completion; if you are typing a
  720.      command, you can do command completion, if you are typing in a
  721.      symbol to GDB, you can do symbol name completion, if you are
  722.      typing in a variable to Bash, you can do variable name
  723.      completion...
  724. `possible-completions (M-?)'
  725.      List the possible completions of the text before point.
  726. File: gdb.info,  Node: Miscellaneous Commands,  Prev: Commands For Completion,  Up: Readline Init Syntax
  727. Some Miscellaneous Commands
  728. ---------------------------
  729. `re-read-init-file (C-x C-r)'
  730.      Read in the contents of your `~/.inputrc' file, and incorporate
  731.      any bindings found there.
  732. `abort (C-g)'
  733.      Stop running the current editing command.
  734. `prefix-meta (ESC)'
  735.      Make the next character that you type be metafied.  This is for
  736.      people without a meta key.  Typing ESC f is equivalent to typing
  737.      M-f.
  738. `undo (C-_)'
  739.      Incremental undo, separately remembered for each line.
  740. `revert-line (M-r)'
  741.      Undo all changes made to this line.  This is like typing the `undo'
  742.      command enough times to get back to the beginning.
  743. File: gdb.info,  Node: Readline Vi Mode,  Prev: Readline Init Syntax,  Up: Readline Init File
  744. Readline Vi Mode
  745. ----------------
  746.    While the Readline library does not have a full set of Vi editing
  747. functions, it does contain enough to allow simple editing of the line.
  748.    In order to switch interactively between Emacs and Vi editing modes,
  749. use the command M-C-j (toggle-editing-mode).
  750.    When you enter a line in Vi mode, you are already placed in
  751. `insertion' mode, as if you had typed an `i'.  Pressing ESC switches
  752. you into `edit' mode, where you can edit the text of the line with the
  753. standard Vi movement keys, move to previous history lines with `k', and
  754. following lines with `j', and so forth.
  755. File: gdb.info,  Node: Using History Interactively,  Next: Renamed Commands,  Prev: Command Line Editing,  Up: Top
  756. Using History Interactively
  757. ***************************
  758.    This chapter describes how to use the GNU History Library
  759. interactively, from a user's standpoint.
  760. * Menu:
  761. * History Interaction::        What it feels like using History as a user.
  762. File: gdb.info,  Node: History Interaction,  Up: Using History Interactively
  763. History Interaction
  764. ===================
  765.    The History library provides a history expansion feature that is
  766. similar to the history expansion in Csh.  The following text describes
  767. the sytax that you use to manipulate the history information.
  768.    History expansion takes place in two parts.  The first is to
  769. determine which line from the previous history should be used during
  770. substitution.  The second is to select portions of that line for
  771. inclusion into the current one.  The line selected from the previous
  772. history is called the "event", and the portions of that line that are
  773. acted upon are called "words".  The line is broken into words in the
  774. same fashion that the Bash shell does, so that several English (or
  775. Unix) words surrounded by quotes are considered as one word.
  776. * Menu:
  777. * Event Designators::    How to specify which history line to use.
  778. * Word Designators::    Specifying which words are of interest.
  779. * Modifiers::        Modifying the results of susbstitution.
  780. File: gdb.info,  Node: Event Designators,  Next: Word Designators,  Up: History Interaction
  781. Event Designators
  782. -----------------
  783.    An event designator is a reference to a command line entry in the
  784. history list.
  785.      Start a history subsititution, except when followed by a space,
  786.      tab, or the end of the line... = or (.
  787.      Refer to the previous command.  This is a synonym for `!-1'.
  788.      Refer to command line N.
  789. `!-n'
  790.      Refer to the command line N lines back.
  791. `!string'
  792.      Refer to the most recent command starting with STRING.
  793. `!?string'[`?']
  794.      Refer to the most recent command containing STRING.
  795. File: gdb.info,  Node: Word Designators,  Next: Modifiers,  Prev: Event Designators,  Up: History Interaction
  796. Word Designators
  797. ----------------
  798.    A : separates the event specification from the word designator.  It
  799. can be omitted if the word designator begins with a ^, $, * or %.
  800. Words are numbered from the beginning of the line, with the first word
  801. being denoted by a 0 (zero).
  802. `0 (zero)'
  803.      The zero'th word.  For many applications, this is the command word.
  804.      The N'th word.
  805.      The first argument.  that is, word 1.
  806.      The last argument.
  807.      The word matched by the most recent `?string?' search.
  808. `x-y'
  809.      A range of words; `-Y' Abbreviates `0-Y'.
  810.      All of the words, excepting the zero'th.  This is a synonym for
  811.      `1-$'.  It is not an error to use * if there is just one word in
  812.      the event.  The empty string is returned in that case.
  813. File: gdb.info,  Node: Modifiers,  Prev: Word Designators,  Up: History Interaction
  814. Modifiers
  815. ---------
  816.    After the optional word designator, you can add a sequence of one or
  817. more of the following modifiers, each preceded by a :.
  818.      The entire command line typed so far.  This means the current
  819.      command, not the previous command, so it really isn't a word
  820.      designator, and doesn't belong in this section.
  821.      Remove a trailing pathname component, leaving only the head.
  822.      Remove a trailing suffix of the form `.'SUFFIX, leaving the
  823.      basename.
  824.      Remove all but the suffix.
  825.      Remove all leading  pathname  components, leaving the tail.
  826.      Print the new command but do not execute it.
  827. File: gdb.info,  Node: Renamed Commands,  Next: Formatting Documentation,  Prev: Using History Interactively,  Up: Top
  828. Renamed Commands
  829. ****************
  830.    The following commands were renamed in GDB 4, in order to make the
  831. command set as a whole more consistent and easier to use and remember:
  832.      OLD COMMAND               NEW COMMAND
  833.      ---------------           -------------------------------
  834.      add-syms                  add-symbol-file
  835.      delete environment        unset environment
  836.      info convenience          show convenience
  837.      info copying              show copying
  838.      info directories          show directories
  839.      info editing              show commands
  840.      info history              show values
  841.      info targets              help target
  842.      info values               show values
  843.      info version              show version
  844.      info warranty             show warranty
  845.      set/show addressprint     set/show print address
  846.      set/show array-max        set/show print elements
  847.      set/show arrayprint       set/show print array
  848.      set/show asm-demangle     set/show print asm-demangle
  849.      set/show caution          set/show confirm
  850.      set/show demangle         set/show print demangle
  851.      set/show history write    set/show history save
  852.      set/show prettyprint      set/show print pretty
  853.      set/show screen-height    set/show height
  854.      set/show screen-width     set/show width
  855.      set/show sevenbit-strings set/show print sevenbit-strings
  856.      set/show unionprint       set/show print union
  857.      set/show vtblprint        set/show print vtbl
  858.      
  859.      unset                     [No longer an alias for delete]
  860. File: gdb.info,  Node: Formatting Documentation,  Next: Installing GDB,  Prev: Renamed Commands,  Up: Top
  861. Formatting Documentation
  862. ************************
  863.    The GDB 4 release includes an already-formatted reference card, ready
  864. for printing with PostScript or GhostScript, in the `gdb' subdirectory
  865. of the main source directory(1).  If you can use PostScript or
  866. GhostScript with your printer, you can print the reference card
  867. immediately with `refcard.ps'.
  868.    The release also includes the source for the reference card.  You
  869. can format it, using TeX, by typing:
  870.      make refcard.dvi
  871.    The GDB reference card is designed to print in landscape mode on US
  872. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  873. high.  You will need to specify this form of printing as an option to
  874. your DVI output program.
  875.    All the documentation for GDB comes as part of the machine-readable
  876. distribution.  The documentation is written in Texinfo format, which is
  877. a documentation system that uses a single source file to produce both
  878. on-line information and a printed manual.  You can use one of the Info
  879. formatting commands to create the on-line version of the documentation
  880. and TeX (or `texi2roff') to typeset the printed version.
  881.    GDB includes an already formatted copy of the on-line Info version of
  882. this manual in the `gdb' subdirectory.  The main Info file is
  883. `gdb-VERSION-NUMBER/gdb/gdb.info', and it refers to subordinate files
  884. matching `gdb.info*' in the same directory.  If necessary, you can
  885. print out these files, or read them with any editor; but they are
  886. easier to read using the `info' subsystem in GNU Emacs or the
  887. standalone `info' program, available as part of the GNU Texinfo
  888. distribution.
  889.    If you want to format these Info files yourself, you need one of the
  890. Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
  891.    If you have `makeinfo' installed, and are in the top level GDB
  892. source directory (`gdb-4.12', in the case of version 4.12), you can
  893. make the Info file by typing:
  894.      cd gdb
  895.      make gdb.info
  896.    If you want to typeset and print copies of this manual, you need TeX,
  897. a program to print its DVI output files, and `texinfo.tex', the Texinfo
  898. definitions file.
  899.    TeX is a typesetting program; it does not print files directly, but
  900. produces output files called DVI files.  To print a typeset document,
  901. you need a program to print DVI files.  If your system has TeX
  902. installed, chances are it has such a program.  The precise command to
  903. use depends on your system; `lpr -d' is common; another (for PostScript
  904. devices) is `dvips'.  The DVI print command may require a file name
  905. without any extension or a `.dvi' extension.
  906.    TeX also requires a macro definitions file called `texinfo.tex'.
  907. This file tells TeX how to typeset a document written in Texinfo
  908. format.  On its own, TeX cannot read, much less typeset a Texinfo file.
  909. `texinfo.tex' is distributed with GDB and is located in the
  910. `gdb-VERSION-NUMBER/texinfo' directory.
  911.    If you have TeX and a DVI printer program installed, you can typeset
  912. and print this manual.  First switch to the the `gdb' subdirectory of
  913. the main source directory (for example, to `gdb-4.12/gdb') and then
  914. type:
  915.      make gdb.dvi
  916.    ---------- Footnotes ----------
  917.    (1)  In `gdb-4.12/gdb/refcard.ps' of the version 4.12 release.
  918.